package pl.eurobank.dev.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.SequenceGenerator;
import javax.validation.constraints.Size;




import org.hibernate.validator.constraints.*;

@Entity
@Table(name = "investment_fund")
public class InvestmentFund {

	private int id;

	@NotEmpty()
	@Size(min = 3)
	private String fundName;
	
	private Set<InvestmentFundUnitType> investmentFundUnitTypeList = new HashSet<InvestmentFundUnitType>(0);

	@SequenceGenerator(name = "inv_fund_seq", sequenceName = "investment_fund_seq")
	@Id
	@GeneratedValue(generator = "inv_fund_seq")
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column(name = "fund_name", unique = true, nullable = false, length = 255)
	public String getFundName() {
		return fundName;
	}

	public void setFundName(String invFundName) {
		this.fundName = invFundName;
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "investmentFund")
	public Set<InvestmentFundUnitType> getInvestmentFundUnitTypeList() {
		return this.investmentFundUnitTypeList;
	}
 
	public void setInvestmentFundUnitTypeList(Set<InvestmentFundUnitType> investmentFundUnitTypeList) {
		this.investmentFundUnitTypeList = investmentFundUnitTypeList;
	}

}